<div id="primary">
	<h1>Edit Your Account</h1>

	<%= error_messages_for :user %>

	<% form_for(:user, @user, :url => user_path(@user), :html => { :method => :put }) do |f| %>

		<div>
		  <%= f.label :first_name %><br />
		  <%= f.text_field :first_name  %>
		</div>

		<div>
		  <%= f.label :last_name %><br />
		  <%= f.text_field :last_name  %>
		</div>

		<div>
		  <%= f.label :email %><br />
		  <%= f.text_field :email  %>
		</div>
		
		<h2>Change Password</h2>
		<div>
		  <%= f.label :password %><br/>
		  <%= f.password_field :password %>
		</div>

		<div>
		  <%= f.label :password_confirmation %><br/>
		  <%= f.password_field :password_confirmation %>
		</div>
		
		<h2>Orphan Queries</h2>
		<p>When a query is made and the command doesn't exist..</p>

		<div class="floatkill">
			<%= radio_button_tag 'use_default_command', 'no', !current_user.default_command? %> 
			<label for="use_default_command_no">Tell me the command doesn't exist.</label>
		</div>

		<div class="floatkill">
			<%= radio_button_tag 'use_default_command', 'yes', current_user.default_command? %> 
			<label for="use_default_command_yes">Run the query using this command: </label>

			<%= f.select :default_command_id, current_user.user_commands.quicksearches.find(:all, :order => "user_commands.keyword ASC").collect {|c| [ "#{c.keyword} - #{c.name.ellipsize(:max => 25)}", c.id ] }, {}, :onfocus => "$('use_default_command_yes').checked = true" %>
		</div>

	  <p>
	    <%= submit_tag "Save Settings", :class => "submit" %>
	  </p>
	<% end %>
</div>

<div id="secondary" class="boxed">
	<h2>Delete Your Account <%= image_tag("warning_sign.png", :height=>50, :width=>50, :style=>'vertical-align: bottom') %></h2>
	<h3>Proceed with caution. This will delete everything from your account, including your user commands and queries.</h3>
	<% form_for(:user, @user, :url => user_path(current_user), :html => { :method => :delete, 
		:onsubmit=>"return confirm('This truly deletes you from our website. Do you want to proceed?');" }) do |f| %>
		<div>
		  <%= f.label :password %><br/>
		  <%= f.password_field :password %>
		</div>

		<div>
		  <%= f.label :password_confirmation %><br/>
		  <%= f.password_field :password_confirmation %>
		</div>
		
		<p>
	    <%= submit_tag "Delete!", :class => "submit" %>
	  </p>
	  
	<% end %>
</div>